Wir bearbeiten ein CASAS Open Data Set aus dem Bereich Care Tech. Ladet das Dataset 33 runter und lest die Daten ein.
Die ZIP Datei enthält eine Readme mit Informationen zum Datensatz und den Sensoren, sowie auch eine Darstellung der Orte der angebrachten Sensoren in der Wohnung.
Hier ein erster Eindruck von den annotierten Daten:
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.3.6 ✔ purrr 0.3.4
## ✔ tibble 3.1.8 ✔ dplyr 1.0.10
## ✔ tidyr 1.2.1 ✔ stringr 1.4.1
## ✔ readr 2.1.2 ✔ forcats 0.5.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
mydata <- read_tsv("../../Daten/hh111/hh111.ann.txt",
col_names = c("timestamp", "name.of.sensor",
"room.level", "room.detail", "message", "sensor.type",
"classes"))
## Rows: 351353 Columns: 7
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: "\t"
## chr (6): name.of.sensor, room.level, room.detail, message, sensor.type, cla...
## dttm (1): timestamp
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
mydata
Mithilfe einer Python-Bibliothek (AL-Smarthome)[https://github.com/WSU-CASAS/AL-Smarthome] sind daraus Features extrahiert worden für weitere Untersuchungen.
myfeatures <- read_csv("../../Daten/hh111/hh111.ann.features.csv")
## Rows: 351324 Columns: 37
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): activity
## dbl (36): lastSensorEventHours, lastSensorEventSeconds, lastSensorDayOfWeek,...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
myfeatures
Gibt es Fehlwerte? Nein, zumindest keine expliziten NA-Werte.
mydata %>%
is.na() %>%
sum()
## [1] 0
Welche Sensor-Typen liegen vor?
mydata %>%
count(sensor.type)
Wie viele Beobachtungen haben Sie von welchen Einzel-Sensoren?
mydata %>%
count(name.of.sensor) %>%
print (n = 38)
## # A tibble: 62 × 2
## name.of.sensor n
## <chr> <int>
## 1 D001 4
## 2 D002 903
## 3 D003 1
## 4 D004 239
## 5 D005 289
## 6 L001 177
## 7 L002 13
## 8 L003 1
## 9 L004 155
## 10 L005 47
## 11 L006 163
## 12 L007 827
## 13 L008 353
## 14 LS001 1335
## 15 LS002 3190
## 16 LS003 5524
## 17 LS004 4892
## 18 LS005 9372
## 19 LS006 7515
## 20 LS007 7155
## 21 LS008 4616
## 22 LS009 7650
## 23 LS010 6003
## 24 LS011 9064
## 25 LS012 6680
## 26 LS013 4837
## 27 LS014 5262
## 28 LS015 6512
## 29 LS016 5081
## 30 LS017 5427
## 31 LS018 5422
## 32 LS019 4294
## 33 LS020 5327
## 34 LS021 6992
## 35 LS022 6104
## 36 M001 2733
## 37 M002 2649
## 38 M003 5877
## # … with 24 more rows
Temperatur-Sensoren sind in den Rohdaten die einzigen metrischen Werte. Für einen ersten Eindruck grafisch darstellen. Wie viele Temepratur-Sensoren gibt es in dem Datensatz und wie viele Beobachtungen stammen von den einzelnen Temperatursensoren?
mydata %>%
filter(sensor.type == "Control4-Temperature") %>%
count(name.of.sensor)
library(ggplot2)
pl1 <- ggplot(data= mydata %>%
filter(sensor.type == "Control4-Temperature"))+
geom_point(aes(y=message,x=classes,color=name.of.sensor),
position=position_jitter(h=0.15,w=0.15))
Die Ausgabe von ggplot ist nicht Interaktiv, daher benutze ich gerne zusätzlich das Paket plotly. Gibt es Auffälligkeiten?
library(plotly)
##
## Attache Paket: 'plotly'
## Das folgende Objekt ist maskiert 'package:ggplot2':
##
## last_plot
## Das folgende Objekt ist maskiert 'package:stats':
##
## filter
## Das folgende Objekt ist maskiert 'package:graphics':
##
## layout
fig <- ggplotly(pl1)
fig
Einige Sensor-Beobachtungen haben bereits ein Flag “Ignore”. Es wird deutlich, dass das die Beobachtungen von T101 sind, die anscheinend nicht valide sind.
pl2 <- ggplot(data= mydata %>%
filter(sensor.type == "Control4-Temperature") %>%
filter(room.detail == "Ignore"))+
geom_point(aes(y=message,x=classes, color=name.of.sensor),
position=position_jitter(h=0.15,w=0.15))
ggplotly(pl2)
Hier alle Beobachtungswerte ohne Ignore-Flag.
pl3 <- ggplot(data= mydata %>%
filter(sensor.type == "Control4-Temperature") %>%
filter(room.detail != "Ignore"))+
geom_point(aes(y=message,x=classes, color=name.of.sensor),
position=position_jitter(h=0.15,w=0.15))
ggplotly(pl3)
Bei welchen Aktivitäten verändern Sensoren ihren Zustand? Dafür ist der Name des Sensors ein Item. Jeder Beobachtungstag ist eine neue Transaktion. Dann kann mit apriori-Algorithmus ermittelt werden, welche Sensoren gemeinsam ihren Zustand während bestimmter Akitivitäten ändern.
library(arules) # Assoziationsregeln
## Lade nötiges Paket: Matrix
##
## Attache Paket: 'Matrix'
## Die folgenden Objekte sind maskiert von 'package:tidyr':
##
## expand, pack, unpack
##
## Attache Paket: 'arules'
## Das folgende Objekt ist maskiert 'package:dplyr':
##
## recode
## Die folgenden Objekte sind maskiert von 'package:base':
##
## abbreviate, write
library(lubridate) #Extraktion von day in year yday()
##
## Attache Paket: 'lubridate'
## Die folgenden Objekte sind maskiert von 'package:arules':
##
## intersect, setdiff, union
## Die folgenden Objekte sind maskiert von 'package:base':
##
## date, intersect, setdiff, union
# jeder einzelne Tag ist eine Transaktion
mydata <- mydata %>%
mutate(trans_id = yday(timestamp)) %>%
filter((room.level != "Ignore")|(room.detail != "Ignore"))
# Aktivitaeten Label bekommen
groups <- mydata %>% select(classes) %>% base::unique() %>% unlist()
Um die Ergebnisse des apriori-Algorithmus abspeichern zu können, wird vorher eine Liste angelegt. Für jede Aktivität gibt es einen Eintrag.
myrules <- vector("list",length(groups))
names(myrules) <- groups
Für jede Aktivität ermittelt apriori Algorithmus Regeln.
for (i in seq_along(groups)){
myrules[[groups[i]]] <- mydata %>%
filter(classes == groups[i]) %>%
transactions(format = "long", cols=c("trans_id","name.of.sensor")) %>%
apriori(parameter=list(supp=0.5, conf=0.9, maxlen=6))
}
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 30
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[36 item(s), 61 transaction(s)] done [0.00s].
## sorting and recoding items ... [29 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 5 6 done [0.05s].
## writing ... [1241815 rule(s)] done [0.10s].
## creating S4 object ... done [0.45s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 24
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[24 item(s), 49 transaction(s)] done [0.00s].
## sorting and recoding items ... [6 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 5 6 done [0.00s].
## writing ... [128 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 18
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[8 item(s), 36 transaction(s)] done [0.00s].
## sorting and recoding items ... [2 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 done [0.00s].
## writing ... [4 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 26
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[11 item(s), 52 transaction(s)] done [0.00s].
## sorting and recoding items ... [2 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 done [0.00s].
## writing ... [4 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 25
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[12 item(s), 51 transaction(s)] done [0.00s].
## sorting and recoding items ... [6 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 5 6 done [0.00s].
## writing ... [142 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 20
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[6 item(s), 41 transaction(s)] done [0.00s].
## sorting and recoding items ... [2 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 done [0.00s].
## writing ... [4 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 17
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[8 item(s), 35 transaction(s)] done [0.00s].
## sorting and recoding items ... [3 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 done [0.00s].
## writing ... [4 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 17
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[8 item(s), 35 transaction(s)] done [0.00s].
## sorting and recoding items ... [2 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 done [0.00s].
## writing ... [2 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 12
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[4 item(s), 24 transaction(s)] done [0.00s].
## sorting and recoding items ... [2 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 done [0.00s].
## writing ... [2 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 23
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[14 item(s), 46 transaction(s)] done [0.00s].
## sorting and recoding items ... [5 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 done [0.00s].
## writing ... [7 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 26
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[9 item(s), 52 transaction(s)] done [0.00s].
## sorting and recoding items ... [2 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 done [0.00s].
## writing ... [4 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 28
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[13 item(s), 57 transaction(s)] done [0.00s].
## sorting and recoding items ... [3 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 done [0.00s].
## writing ... [8 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 28
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[15 item(s), 57 transaction(s)] done [0.00s].
## sorting and recoding items ... [3 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 done [0.00s].
## writing ... [12 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 26
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[8 item(s), 53 transaction(s)] done [0.00s].
## sorting and recoding items ... [2 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 done [0.00s].
## writing ... [2 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 27
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[22 item(s), 54 transaction(s)] done [0.00s].
## sorting and recoding items ... [5 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 done [0.00s].
## writing ... [30 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 4
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[7 item(s), 8 transaction(s)] done [0.00s].
## sorting and recoding items ... [3 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 done [0.00s].
## writing ... [6 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 4
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[7 item(s), 8 transaction(s)] done [0.00s].
## sorting and recoding items ... [4 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 done [0.00s].
## writing ... [9 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 12
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[6 item(s), 25 transaction(s)] done [0.00s].
## sorting and recoding items ... [1 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 done [0.00s].
## writing ... [1 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 13
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[12 item(s), 26 transaction(s)] done [0.00s].
## sorting and recoding items ... [3 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 done [0.00s].
## writing ... [8 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 12
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[11 item(s), 24 transaction(s)] done [0.00s].
## sorting and recoding items ... [1 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 done [0.00s].
## writing ... [0 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 9
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[6 item(s), 19 transaction(s)] done [0.00s].
## sorting and recoding items ... [1 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 done [0.00s].
## writing ... [1 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 21
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[15 item(s), 43 transaction(s)] done [0.00s].
## sorting and recoding items ... [3 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 done [0.00s].
## writing ... [12 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 9
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[7 item(s), 18 transaction(s)] done [0.00s].
## sorting and recoding items ... [2 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 done [0.00s].
## writing ... [2 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 19
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[9 item(s), 38 transaction(s)] done [0.00s].
## sorting and recoding items ... [2 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 done [0.00s].
## writing ... [4 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 22
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[5 item(s), 44 transaction(s)] done [0.00s].
## sorting and recoding items ... [2 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 done [0.00s].
## writing ... [4 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 12
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[6 item(s), 25 transaction(s)] done [0.00s].
## sorting and recoding items ... [2 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 done [0.00s].
## writing ... [2 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 10
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[8 item(s), 20 transaction(s)] done [0.00s].
## sorting and recoding items ... [3 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 done [0.00s].
## writing ... [12 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 6
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[10 item(s), 12 transaction(s)] done [0.00s].
## sorting and recoding items ... [3 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 done [0.00s].
## writing ... [3 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 10
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[6 item(s), 20 transaction(s)] done [0.00s].
## sorting and recoding items ... [2 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 done [0.00s].
## writing ... [4 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 10
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[5 item(s), 20 transaction(s)] done [0.00s].
## sorting and recoding items ... [2 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 done [0.00s].
## writing ... [2 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 8
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[5 item(s), 16 transaction(s)] done [0.00s].
## sorting and recoding items ... [1 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 done [0.00s].
## writing ... [1 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 8
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[9 item(s), 16 transaction(s)] done [0.00s].
## sorting and recoding items ... [3 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 done [0.00s].
## writing ... [0 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 3
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[6 item(s), 6 transaction(s)] done [0.00s].
## sorting and recoding items ... [2 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 done [0.00s].
## writing ... [2 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 8
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[38 item(s), 17 transaction(s)] done [0.00s].
## sorting and recoding items ... [31 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 5 6 done [0.04s].
## writing ... [2249200 rule(s)] done [0.17s].
## creating S4 object ... done [0.43s].
## Apriori
##
## Parameter specification:
## confidence minval smax arem aval originalSupport maxtime support minlen
## 0.9 0.1 1 none FALSE TRUE 5 0.5 1
## maxlen target ext
## 6 rules TRUE
##
## Algorithmic control:
## filter tree heap memopt load sort verbose
## 0.1 TRUE TRUE FALSE TRUE 2 TRUE
##
## Absolute minimum support count: 10
##
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[6 item(s), 21 transaction(s)] done [0.00s].
## sorting and recoding items ... [2 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 done [0.00s].
## writing ... [2 rule(s)] done [0.00s].
## creating S4 object ... done [0.00s].
Darstellung der Assoziationsregeln. Eine “leere” Regel, d.h. LHS = {}, bedeutet, dass egal was links im Itemset steht, es wird immer zur RHS führen.
# Ausgabe der Ergebnisse
for (i in seq_along(groups)){
print(groups[i])
myrules[[groups[i]]] %>% head(n=3, by="lift") %>% inspect
}
## classes1
## "Other_Activity"
## lhs rhs support confidence coverage
## [1] {M001, M005, M020, T102, T103} => {M008} 0.5245902 0.9411765 0.5573770
## [2] {L007, M001, M005, T102, T103} => {M008} 0.5245902 0.9411765 0.5573770
## [3] {D002, M005, T102, T103} => {M008} 0.5081967 0.9393939 0.5409836
## lift count
## [1] 1.335157 32
## [2] 1.335157 32
## [3] 1.332629 31
## classes2
## "Sleep"
## lhs rhs support confidence coverage lift count
## [1] {T102} => {T104} 0.7346939 0.972973 0.755102 1.059459 36
## [2] {M020, T102} => {T104} 0.7346939 0.972973 0.755102 1.059459 36
## [3] {M022, T102} => {T104} 0.7346939 0.972973 0.755102 1.059459 36
## classes3
## "Bed_Toilet_Transition"
## lhs rhs support confidence coverage lift count
## [1] {} => {M010} 1 1 1 1 36
## [2] {} => {MA011} 1 1 1 1 36
## [3] {M010} => {MA011} 1 1 1 1 36
## classes4
## "Personal_Hygiene"
## lhs rhs support confidence coverage lift count
## [1] {} => {M010} 1 1 1 1 52
## [2] {} => {MA011} 1 1 1 1 52
## [3] {M010} => {MA011} 1 1 1 1 52
## classes5
## "Dress"
## lhs rhs support confidence coverage lift count
## [1] {L008, M020} => {M018} 0.745098 0.9047619 0.8235294 1.048701 38
## [2] {L008, M022} => {M018} 0.745098 0.9047619 0.8235294 1.048701 38
## [3] {L008, M020, M022} => {M018} 0.745098 0.9047619 0.8235294 1.048701 38
## classes6
## "Morning_Meds"
## lhs rhs support confidence coverage lift count
## [1] {M010} => {MA011} 0.9756098 1.0000000 0.9756098 1.025 40
## [2] {MA011} => {M010} 0.9756098 1.0000000 0.9756098 1.025 40
## [3] {} => {M010} 0.9756098 0.9756098 1.0000000 1.000 40
## classes7
## "Cook_Breakfast"
## lhs rhs support confidence coverage lift count
## [1] {} => {M007} 1.0000000 1 1.0000000 1 35
## [2] {MA015} => {M007} 0.6857143 1 0.6857143 1 24
## [3] {M008} => {M007} 0.8000000 1 0.8000000 1 28
## classes8
## "Eat_Breakfast"
## lhs rhs support confidence coverage lift count
## [1] {MA006} => {M005} 0.8571429 1.0000000 0.8571429 1.029412 30
## [2] {} => {M005} 0.9714286 0.9714286 1.0000000 1.000000 34
## classes9
## "Wash_Breakfast_Dishes"
## lhs rhs support confidence coverage lift count
## [1] {} => {M007} 1.000 1 1.000 1 24
## [2] {M008} => {M007} 0.625 1 0.625 1 15
## classes10
## "Read"
## lhs rhs support confidence coverage lift count
## [1] {MA021} => {M022} 0.5434783 1.0000000 0.5434783 1.533333 25
## [2] {M020} => {M022} 0.6304348 1.0000000 0.6304348 1.533333 29
## [3] {M022} => {M020} 0.6304348 0.9666667 0.6521739 1.533333 29
## classes11
## "Toilet"
## lhs rhs support confidence coverage lift count
## [1] {} => {M010} 1 1 1 1 52
## [2] {} => {MA011} 1 1 1 1 52
## [3] {M010} => {MA011} 1 1 1 1 52
## classes12
## "Leave_Home"
## lhs rhs support confidence coverage lift count
## [1] {} => {M001} 1.0000000 1 1.0000000 1 57
## [2] {} => {D002} 1.0000000 1 1.0000000 1 57
## [3] {M002} => {M001} 0.8596491 1 0.8596491 1 49
## classes13
## "Enter_Home"
## lhs rhs support confidence coverage lift count
## [1] {} => {M002} 0.9298246 0.9298246 1 1 53
## [2] {} => {M001} 1.0000000 1.0000000 1 1 57
## [3] {} => {D002} 1.0000000 1.0000000 1 1 57
## classes14
## "Drink"
## lhs rhs support confidence coverage lift count
## [1] {} => {M007} 1.0000000 1 1.0000000 1 53
## [2] {M008} => {M007} 0.6981132 1 0.6981132 1 37
## classes15
## "Work_On_Computer"
## lhs rhs support confidence coverage lift count
## [1] {T102} => {T103} 0.5185185 1 0.5185185 1.384615 28
## [2] {MA006, T102} => {T103} 0.5185185 1 0.5185185 1.384615 28
## [3] {M005, T102} => {T103} 0.5185185 1 0.5185185 1.384615 28
## classes16
## "Cook"
## lhs rhs support confidence coverage lift count
## [1] {D005} => {M008} 0.5 1 0.5 1.142857 4
## [2] {D005, M007} => {M008} 0.5 1 0.5 1.142857 4
## [3] {} => {M007} 1.0 1 1.0 1.000000 8
## classes17
## "Eat"
## lhs rhs support confidence coverage lift count
## [1] {M020} => {M022} 0.5 1 0.5 2 4
## [2] {M022} => {M020} 0.5 1 0.5 2 4
## [3] {M020} => {MA021} 0.5 1 0.5 2 4
## classes18
## "Wash_Dishes"
## lhs rhs support confidence coverage lift count
## [1] {} => {M007} 1 1 1 1 25
## classes19
## "Cook_Dinner"
## lhs rhs support confidence coverage lift count
## [1] {} => {M007} 1.0000000 1 1.0000000 1 26
## [2] {} => {M008} 1.0000000 1 1.0000000 1 26
## [3] {MA015} => {M007} 0.8461538 1 0.8461538 1 22
## classes20
## "Eat_Dinner"
## classes21
## "Wash_Dinner_Dishes"
## lhs rhs support confidence coverage lift count
## [1] {} => {M007} 1 1 1 1 19
## classes22
## "Watch_TV"
## lhs rhs support confidence coverage lift count
## [1] {MA021} => {M020} 0.8837209 0.974359 0.9069767 1.047436 38
## [2] {M020} => {MA021} 0.8837209 0.950000 0.9302326 1.047436 38
## [3] {M022, MA021} => {M020} 0.8837209 0.974359 0.9069767 1.047436 38
## classes23
## "Work_At_Desk"
## lhs rhs support confidence coverage lift count
## [1] {} => {M005} 1.0000000 1 1.0000000 1 18
## [2] {MA006} => {M005} 0.7777778 1 0.7777778 1 14
## classes24
## "Groom"
## lhs rhs support confidence coverage lift count
## [1] {} => {M010} 1 1 1 1 38
## [2] {} => {MA011} 1 1 1 1 38
## [3] {M010} => {MA011} 1 1 1 1 38
## classes25
## "Evening_Meds"
## lhs rhs support confidence coverage lift count
## [1] {} => {M010} 1 1 1 1 44
## [2] {} => {MA011} 1 1 1 1 44
## [3] {M010} => {MA011} 1 1 1 1 44
## classes26
## "Bathe"
## lhs rhs support confidence coverage lift count
## [1] {} => {MA011} 1.00 1 1.00 1 25
## [2] {M010} => {MA011} 0.64 1 0.64 1 16
## classes27
## "Step_Out"
## lhs rhs support confidence coverage lift count
## [1] {} => {M002} 0.95 0.95 1 1 19
## [2] {} => {M001} 1.00 1.00 1 1 20
## [3] {} => {D002} 1.00 1.00 1 1 20
## classes28
## "Phone"
## lhs rhs support confidence coverage lift count
## [1] {MA021} => {M022} 0.7500000 1.0000000 0.75 1.090909 9
## [2] {M020, MA021} => {M022} 0.5000000 1.0000000 0.50 1.090909 6
## [3] {} => {M022} 0.9166667 0.9166667 1.00 1.000000 11
## classes29
## "Cook_Lunch"
## lhs rhs support confidence coverage lift count
## [1] {} => {M008} 0.95 0.95 1.00 1 19
## [2] {} => {M007} 1.00 1.00 1.00 1 20
## [3] {M008} => {M007} 0.95 1.00 0.95 1 19
## classes30
## "Eat_Lunch"
## lhs rhs support confidence coverage lift count
## [1] {MA006} => {M005} 0.85 1.00 0.85 1.052632 17
## [2] {} => {M005} 0.95 0.95 1.00 1.000000 19
## classes31
## "Wash_Lunch_Dishes"
## lhs rhs support confidence coverage lift count
## [1] {} => {M007} 1 1 1 1 16
## classes32
## "Relax"
## classes33
## "Work_At_Table"
## lhs rhs support confidence coverage lift count
## [1] {} => {MA015} 1.0000000 1 1.0000000 1 6
## [2] {M016} => {MA015} 0.8333333 1 0.8333333 1 5
## classes34
## "Entertain_Guests"
## lhs rhs support confidence coverage
## [1] {M001, M022, MA021} => {D002} 0.5294118 1 0.5294118
## [2] {M001, M022, MA019, MA021} => {D002} 0.5294118 1 0.5294118
## [3] {M001, M020, M022, MA021} => {D002} 0.5294118 1 0.5294118
## lift count
## [1] 1.888889 9
## [2] 1.888889 9
## [3] 1.888889 9
## classes35
## "Work"
## lhs rhs support confidence coverage lift count
## [1] {MA006} => {M005} 0.7619048 1.000000 0.7619048 1.05 16
## [2] {} => {M005} 0.9523810 0.952381 1.0000000 1.00 20